#include <null_object_pattern.h>

RealCustomer::RealCustomer(string name)
{
    this->name = name;
}

string RealCustomer::getName()
{
    return this->name;
}

bool RealCustomer::isNil()
{
    return false;
}

string NullCustomer::getName()
{
    return "Not Available in Customer Database";
}

bool NullCustomer::isNil()
{
    return true;
}

AbstractCustomer* CustomerFactory::getCustomer(string name)
{
    for(int i = 0; i < 3; i++)
    {
        if(CustomerFactory::names[i] == name)
        {
            return new RealCustomer(name);
            break;
        }
    }
    return new NullCustomer;
}
